package com.example.alibabanacosdiscoveryclient.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:guoq
 * @date:2025/4/1
 * @descripion:
 */

@RestController
@RequestMapping("/ai")
@Tag(name = "mcp-client-stater应用")
public class MCPClientStarterController {
    @Resource
    private ChatClient chatClient;

    @GetMapping("/mcp/chat")
    @Operation(summary = "mcp对话式应用")
    public String chat(String message) {
        // 使用流式API调用聊天
        String content = chatClient
                .prompt()
                .user(message)
                .call()
                .content();
        return content;
    }


}

